<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: Nlu</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: Nlu</h1>

    




<section>

<header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>Nlu<span class="signature">(intents)</span><span class="type-signature"></span></h2>
        
            <div class="class-description">封装DuerOS 对query的解析结果
只有IntentRequest 才有Nlu结构</div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    
    <h4 class="name" id="Nlu"><span class="type-signature"></span>new Nlu<span class="signature">(intents)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    构造函数
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>intents</code></td>
            

            <td class="type">
            
                
<span class="param-type">array</span>


            
            </td>

            

            

            <td class="description last">IntentRequest 中的intents</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line26">line 26</a>
    </li></ul></dd>
    

    

    

    
</dl>


















    
    </div>

    

    

    

    

    

    

    
        <h3 class="subsection-title">Members</h3>

        
            
<h4 class="name" id="_directive"><span class="type-signature"></span>_directive<span class="type-signature"></span></h4>




<div class="description">
    记录返回的指令
</div>







<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line40">line 40</a>
    </li></ul></dd>
    

    

    

    
</dl>






        
    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    
    <h4 class="name" id="ask"><span class="type-signature"></span>ask<span class="signature">(slot)</span><span class="type-signature"> &rarr; {null}</span></h4>
    

    



<div class="description">
    Bot主动发起对一个槽位的询问。比如：打车时询问用户目的地
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>slot</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last">槽位名</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line124">line 124</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">null</span>


    </dd>
</dl>

    




    <h5>Example</h5>
    
    <pre class="prettyprint"><code>this.ask('destination');</code></pre>



        
            

    

    
    <h4 class="name" id="getIntentConfirmationStatus"><span class="type-signature"></span>getIntentConfirmationStatus<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    获取一个intent对应的confirmationStatus
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line240">line 240</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    {string 意图的confirmationStatus
</div>



    





        
            

    

    
    <h4 class="name" id="getIntentName"><span class="type-signature"></span>getIntentName<span class="signature">()</span><span class="type-signature"> &rarr; {string|null}</span></h4>
    

    



<div class="description">
    获取DuerOS请求中的意图名
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line99">line 99</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>
|

<span class="param-type">null</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getSlot"><span class="type-signature"></span>getSlot<span class="signature">(field, index)</span><span class="type-signature"> &rarr; {null|string}</span></h4>
    

    



<div class="description">
    通过槽位名获取一个槽位的值
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>field</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            
                <td class="default">
                
                </td>
            

            <td class="description last">槽位名</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>index</code></td>
            

            <td class="type">
            
                
<span class="param-type">Integer</span>


            
            </td>

            

            
                <td class="default">
                
                    0
                
                </td>
            

            <td class="description last">第几个intent，默认第一个</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line80">line 80</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">null</span>
|

<span class="param-type">string</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getSlotConfirmationStatus"><span class="type-signature"></span>getSlotConfirmationStatus<span class="signature">(field)</span><span class="type-signature"> &rarr; {string}</span></h4>
    

    



<div class="description">
    获取一个slot对应的confirmationStatus
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>field</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last">槽位名</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line226">line 226</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    槽位的confirmationStatus
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="hasAsked"><span class="type-signature"></span>hasAsked<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
    

    



<div class="description">
    Bot是否在询问用户，等待用户的回复
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line110">line 110</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="setConfirmIntent"><span class="type-signature"></span>setConfirmIntent<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    主动发起对一个意图的确认，此时还需同时返回询问的outputSpeach。
主动发起的确认，DM不会使用默认配置的话术。
一般当槽位填槽完毕，在进行下一步操作之前，一次性的询问各个槽位，是否符合用户预期。
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line213">line 213</a>
    </li></ul></dd>
    

    

    

    
</dl>

















    <h5>Example</h5>
    
    <pre class="prettyprint"><code>this.setConfirmIntent();</code></pre>



        
            

    

    
    <h4 class="name" id="setConfirmSlot"><span class="type-signature"></span>setConfirmSlot<span class="signature">(field)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    主动发起对一个槽位的确认，此时还需同时返回询问的outputSpeach。
主动发起的确认，DM不会使用默认配置的话术。
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>field</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last">槽位名</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line187">line 187</a>
    </li></ul></dd>
    

    

    

    
</dl>

















    <h5>Example</h5>
    
    <pre class="prettyprint"><code>this.setConfirmSlot('destination');</code></pre>



        
            

    

    
    <h4 class="name" id="setDelegate"><span class="type-signature"></span>setDelegate<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    设置将对话的处理代理给Dialog Management(DM)。
    按事先配置的顺序，包括对缺失槽位的询问，槽位值的确认（如果设置了槽位需要确认，以及确认的话术）
    和整个意图的确认（如果设置了意图需要确认，以及确认的话术。比如可以将收集的槽位依次列出，等待用户确认）
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line170">line 170</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="setSlot"><span class="type-signature"></span>setSlot<span class="signature">(field, value, index)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    通过槽位名设置一个槽位的值，如果没有此槽位，新增一个
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>field</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            
                <td class="default">
                
                </td>
            

            <td class="description last">槽位名</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            
                <td class="default">
                
                </td>
            

            <td class="description last">值</td>
        </tr>

    

        <tr>
            
                <td class="name"><code>index</code></td>
            

            <td class="type">
            
                
<span class="param-type">Integer</span>


            
            </td>

            

            
                <td class="default">
                
                    0
                
                </td>
            

            <td class="description last">第几个intent，默认第一个</td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line51">line 51</a>
    </li></ul></dd>
    

    

    

    
</dl>


















        
            

    

    
    <h4 class="name" id="toDirective"><span class="type-signature"></span>toDirective<span class="signature">()</span><span class="type-signature"> &rarr; {array}</span></h4>
    

    















<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line139">line 139</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">array</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="toUpdateIntent"><span class="type-signature"></span>toUpdateIntent<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
    

    















<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="Nlu.js.html">Nlu.js</a>, <a href="Nlu.js.html#line146">line 146</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Object</span>


    </dd>
</dl>

    





        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BaseCard.html">BaseCard</a></li><li><a href="BaseDirective.html">BaseDirective</a></li><li><a href="Bot.html">Bot</a></li><li><a href="card_BaseCard.js.html">card/BaseCard.js</a></li><li><a href="Certificate.html">Certificate</a></li><li><a href="directive_BaseDirective.js.html">directive/BaseDirective.js</a></li><li><a href="ImageCard.html">ImageCard</a></li><li><a href="LinkAccountCard.html">LinkAccountCard</a></li><li><a href="ListCard.html">ListCard</a></li><li><a href="ListCardItem.html">ListCardItem</a></li><li><a href="Nlu.html">Nlu</a></li><li><a href="Play.html">Play</a></li><li><a href="Request.html">Request</a></li><li><a href="Response.html">Response</a></li><li><a href="Session.html">Session</a></li><li><a href="StandardCard.html">StandardCard</a></li><li><a href="Stop.html">Stop</a></li><li><a href="TextCard.html">TextCard</a></li></ul><h3>Namespaces</h3><ul><li><a href="Bot.Card.html">Card</a></li><li><a href="Bot.Directive.html">Directive</a></li><li><a href="Bot.Directive.AudioPlayer.html">AudioPlayer</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Jan 15 2018 20:07:45 GMT+0800 (CST)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>